﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kokomo.PeInspector.VisualStudioAdapter;

namespace Kokomo.PeInspector
{
	class ProjectFormat
	{
		static ProjectFormat()
		{
			VisualCSharp2008 = new ProjectFormat(Messages.VisualCSharp2008, () => new CSharp2008Project());
			VisualCSharp2010 = new ProjectFormat(Messages.VisualCSharp2010, () => new CSharp2010Project());
		}

		public static ProjectFormat VisualCSharp2008 { get; private set; }
		public static ProjectFormat VisualCSharp2010 { get; private set; }

		public ProjectFormat(
			string name,
			Func<CSharpProject> createProjectDelegate
			)
		{
			if (name == null) throw new ArgumentNullException("name");
			if (createProjectDelegate == null) throw new ArgumentNullException("createProjectDelegate");

			this.Name = name;
			this._createProjectDelegate = createProjectDelegate;
		}

		public override string ToString()
		{
			return this.Name;
		}

		public string Name { get; private set; }
		private Func<CSharpProject> _createProjectDelegate;

		public CSharpProject CreateProject()
		{
			return this._createProjectDelegate();
		}
	}
}
